import * as Cesium from 'Cesium'

function colorConvert(colorString) {
    const red = parseInt(colorString.slice(1, 3), 16) / 255
    const green = parseInt(colorString.slice(3, 5), 16) / 255
    const blue = parseInt(colorString.slice(5, 7), 16) / 255
    return new Cesium.Color(red, green, blue)
}

function subSymbolsTypeString(subSymbolsLength, geometry) {
    if (0 === subSymbolsLength) {
        return ''
    } else {
        if (100 === geometry.libID) {
            if (100 === geometry.subSymbols[0].code) {
                return '陆军'
            }
            if (123 === geometry.subSymbols[0].code) {
                return '海军'
            }
            if (300 === geometry.subSymbols[0].code) {
                return '空军'
            }
        } else if (123 === geometry.libID) {
            if (10101 === geometry.subSymbols[0].code) {
                return '武装警察部队'
            }
            if (10102 === geometry.subSymbols[0].code) {
                return '防爆装甲'
            }
            if (10103 === geometry.subSymbols[0].code) {
                return '火炮'
            }
        } else if (900 === geometry.libID) {
            if (910200 === geometry.subSymbols[0].code) {
                return '人民防空重点城市'
            }
            if (910300 === geometry.subSymbols[0].code) {
                return '人民防空基本指挥所'
            }
            if (910402 === geometry.subSymbols[0].code) {
                return '水路抢修专业队'
            }
        } else if (0 === geometry.libID) {
            if (9 === geometry.subSymbols[0].code) {
                return '刑警'
            }
            if (80103 === geometry.subSymbols[0].code) {
                return '交警'
            }
            if (80109 === geometry.subSymbols[0].code) {
                return '专业警'
            }
        }
    }
}

function libIDToString(libID) {
    if (421 == libID) {
        return '421(警用库)'
    } else if (100 == libID) {
        return '100(军队库)'
    } else if (123 == libID) {
        return '123(武警库)'
    } else if (900 == libID) {
        return '900(人防库)'
    }
}

/**
 * 三维标号属性编辑器
 */
export default class StylePanel3D {
    constructor(plotting) {
        this._plotting = plotting

        this._group = [
            '基本',
            '衬线',
            '军标大小',
            '线型',
            '填充',
            '文本',
            '子标号',
            '箭头类型',
            '缩放比例',
            '旋转角度',
            '图片大小',
            '绘制墙',
        ]
        this._displayName = [
            '镜像',
            '标号级别',
            '点标号显示模式',
            '模型路径',
            '图片路径',
            '整体高度',
            'Width',
            'Height',
            'x',
            'y',
            'z',
            '拉伸高度',
            '模型缩放',
            '矢量缩放',
        ]
        this._displayLineStyleName = ['线宽', '线颜色', '线型']
        this._displayFillStyleName = [
            '填充背景色',
            '填充背景透明度',
            '渐变填充角度',
            '渐变填充模式',
            '渐变填充竖直偏移',
            '渐变填充水平偏移',
            '填充色',
            '填充模式',
            '填充透明度',
        ]
        this._displayTextContentName = [
            '注记内容',
            '注记位置',
            '字体背景颜色',
            '注记大小',
            '注记字体',
            '注记颜色',
            '字体边框',
            '边框宽度',
            '边框颜色',
            '总是显示中间注记',
        ]
        this._displaySurroundLineName = [
            '衬线类型',
            '衬线宽',
            '衬线颜色',
            '衬线透明度',
        ]
        this._displayPositionName = ['经度', '纬度', '高度']
        this._displayExtendWallName = ['绘制墙', '拉伸墙透明度']
        this._algoGroup = ['贴地形']
    }
    /**
     * @param graphicObject
     * @returns {Array}
     */
    collectionPropertyGridRows(graphicObject) {
        if (
            null === graphicObject ||
            undefined === graphicObject ||
            graphicObject.symbolName === 'GroupObject'
        ) {
            return []
        }

        let rows = []
        if (null !== graphicObject && undefined !== graphicObject) {
            rows = [
                { name: '标号ID', value: graphicObject.id, group: '标号' },
                { name: '标号库ID', value: graphicObject.libID, group: '标号' },
                { name: '标号code', value: graphicObject.code, group: '标号' },
                {
                    name: '标号名字',
                    value: graphicObject.symbolName,
                    group: '标号',
                },
            ]

            const annotationRows = this.getAnnotationRows(graphicObject)
            const symbolRankRows = this.getSymbolRankRows(graphicObject)
            const surroundLineTypeRows =
                this.getSurroundLineTypeRows(graphicObject)
            const dotShowModeRows = this.getDotShowModeRows(graphicObject)
            const fillSymbolIDRows = this.getFillSymbolIDRows(graphicObject)
            const fillGradientRows = this.getFillGradientModeRows(graphicObject)
            const lineStyleRows = this.getLineStyleRows(graphicObject)
            const subSymbolsTypeRows = this.getSubSymbolsTypeRows(graphicObject)

            // 镜像
            const dotSymbolNegativeImageObj = {}
            dotSymbolNegativeImageObj.name = this._displayName[0]
            dotSymbolNegativeImageObj.value = this.checkboxValueToString(
                graphicObject.isNegativeImage
            )
            dotSymbolNegativeImageObj.group = this._group[0]
            dotSymbolNegativeImageObj.editor = {
                type: 'switch',
                options: { on: true, off: false },
            }

            // 标号级别
            const dotSymbolRankObj = {}
            dotSymbolRankObj.name = this._displayName[1]
            dotSymbolRankObj.value = this.symbolRankToString(
                graphicObject.symbolRank
            )
            dotSymbolRankObj.group = this._group[0]
            dotSymbolRankObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: symbolRankRows,
                },
            }

            // 显示模式
            const dotSymbolShowModeObj = {}
            dotSymbolShowModeObj.name = this._displayName[2]
            dotSymbolShowModeObj.value = this.showModeToString(
                graphicObject.showMode
            )
            dotSymbolShowModeObj.group = this._group[0]
            dotSymbolShowModeObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: dotShowModeRows,
                },
            }

            // 模型ID
            const modelIdObj = {}
            modelIdObj.name = this._displayName[3]
            modelIdObj.value = graphicObject.modelPath
            modelIdObj.group = this._group[0]
            modelIdObj.editor = 'text'

            // 图片路径
            const picturePathObj = {}
            picturePathObj.name = this._displayName[4]
            picturePathObj.value = graphicObject.picturePath
            picturePathObj.group = this._group[0]
            picturePathObj.editor = 'text'

            // 线宽
            const lineWidthObj = {}
            lineWidthObj.name = this._displayLineStyleName[0]
            lineWidthObj.value =
                1 === graphicObject._symbolType
                    ? graphicObject.gridLineWidth
                    : graphicObject.symbolStyle.lineWidth
            lineWidthObj.group = this._group[3]
            lineWidthObj.editor = 'text'

            // 线色
            const lineColorObj = {}
            lineColorObj.name = this._displayLineStyleName[1]
            lineColorObj.value = this.colorGeometryToString(
                graphicObject.symbolStyle.lineColor
            )
            lineColorObj.group = this._group[3]
            lineColorObj.editor = 'colorpicker'

            //拉伸墙
            const extendWallObj = {}
            extendWallObj.name = this._displayExtendWallName[0]
            extendWallObj.value = graphicObject.extendWallHeight
            extendWallObj.group = this._group[11]
            extendWallObj.editor = 'text'

            //拉伸墙透明度
            const extendWallOpacity = {}
            extendWallOpacity.name = this._displayExtendWallName[1]
            extendWallOpacity.value = graphicObject.extendWallOpacity
            extendWallOpacity.group = this._group[11]
            extendWallOpacity.editor = 'text'

            //贴地形
            const isClampToGround = {}
            isClampToGround.name = this._algoGroup[0]
            isClampToGround.value = this.checkboxValueToString(
                graphicObject.isClampToGround
            )
            isClampToGround.group = this._group[0]
            isClampToGround.editor = {
                type: 'switch',
                options: { on: true, off: false },
            }

            // 线型
            const lineStyleObj = {}
            lineStyleObj.name = this._displayLineStyleName[2]
            lineStyleObj.value = this.lineStyleToString(
                graphicObject.lineSymbolID
            )
            lineStyleObj.group = this._group[3]
            lineStyleObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: lineStyleRows,
                },
            }

            // 填充背景色
            const fillBackColorObj = {}
            fillBackColorObj.name = this._displayFillStyleName[0]
            fillBackColorObj.value = this.colorGeometryToString(
                graphicObject.symbolStyle.fillBackColor
            )
            fillBackColorObj.group = this._group[4]
            fillBackColorObj.editor = 'colorpicker'

            // 背景透明
            const fillBackOpaqueObj = {}
            fillBackOpaqueObj.name = this._displayFillStyleName[1]
            fillBackOpaqueObj.value = graphicObject.symbolStyle.fillBackOpaque
            fillBackOpaqueObj.group = this._group[4]
            fillBackOpaqueObj.editor = {
                type: 'switch',
                options: { on: true, off: false },
            }

            // 渐变填充角度
            const fillGradientAngleObj = {}
            fillGradientAngleObj.name = this._displayFillStyleName[2]
            fillGradientAngleObj.value =
                graphicObject.symbolStyle.fillGradientAngle
            fillGradientAngleObj.group = this._group[4]
            fillGradientAngleObj.editor = 'text'

            // 渐变填充模式
            const fillGradientModeObj = {}
            fillGradientModeObj.name = this._displayFillStyleName[3]
            fillGradientModeObj.value = this.fillGradientModeToString(
                graphicObject.symbolStyle.fillGradientMode
            )
            fillGradientModeObj.group = this._group[4]
            fillGradientModeObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: fillGradientRows,
                },
            }

            // 渐变填充竖直偏移
            const fillGradientOffsetRatioYObj = {}
            fillGradientOffsetRatioYObj.name = this._displayFillStyleName[4]
            fillGradientOffsetRatioYObj.value =
                graphicObject.symbolStyle.fillGradientOffsetRatioY
            fillGradientOffsetRatioYObj.group = this._group[4]
            fillGradientOffsetRatioYObj.editor = 'text'

            // 渐变填充水平偏移
            const fillGradientOffsetRatioXObj = {}
            fillGradientOffsetRatioXObj.name = this._displayFillStyleName[5]
            fillGradientOffsetRatioXObj.value =
                graphicObject.symbolStyle.fillGradientOffsetRatioY
            fillGradientOffsetRatioXObj.group = this._group[4]
            fillGradientOffsetRatioXObj.editor = 'text'

            // 前景色
            const fillForeColorObj = {}
            fillForeColorObj.name = this._displayFillStyleName[6]
            fillForeColorObj.value = this.colorGeometryToString(
                graphicObject.symbolStyle.fillForeColor
            )
            fillForeColorObj.group = this._group[4]
            fillForeColorObj.editor = 'colorpicker'

            // 填充模式
            const fillSymbolIdObj = {}
            fillSymbolIdObj.name = this._displayFillStyleName[7]
            fillSymbolIdObj.value = this.fillSymbolIdToString(
                graphicObject.symbolStyle.fillSymbolID
            )
            fillSymbolIdObj.group = this._group[4]
            fillSymbolIdObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: fillSymbolIDRows,
                },
            }

            // 填充透明度
            const fillOpaqueRateObj = {}
            fillOpaqueRateObj.name = this._displayFillStyleName[8]
            fillOpaqueRateObj.value = graphicObject.symbolStyle.fillOpaqueRate
            fillOpaqueRateObj.group = this._group[4]
            fillOpaqueRateObj.editor = 'text'

            // 文本内容
            const textContentObj = {}
            textContentObj.name = this._displayTextContentName[0]
            if (34 == graphicObject.symbolType) {
                textContentObj.value = graphicObject.textContent
            } else {
                textContentObj.value = graphicObject.textContent
            }
            textContentObj.group = this._group[5]
            textContentObj.editor = 'text'

            // 注记位置
            const markPosObj = {}
            markPosObj.name = this._displayTextContentName[1]
            markPosObj.value = this.annotationToString(graphicObject.textPos)
            markPosObj.group = this._group[5]
            markPosObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: annotationRows,
                },
            }

            // 字体背景颜色
            const fontBackColor = {}
            fontBackColor.name = this._displayTextContentName[2]
            fontBackColor.value = this.colorGeometryToString(
                graphicObject.symbolTextStyle.backColor
            )
            fontBackColor.group = this._group[5]
            fontBackColor.editor = 'colorpicker'

            // 注记字体大小
            const fontSizeObj = {}
            fontSizeObj.name = this._displayTextContentName[3]
            fontSizeObj.value = graphicObject.symbolTextStyle.fontSize
            fontSizeObj.group = this._group[5]
            fontSizeObj.editor = 'text'

            // 注记字体名称
            const fontFamilyObj = {}
            fontFamilyObj.name = this._displayTextContentName[4]
            fontFamilyObj.value = graphicObject.symbolTextStyle.fontName
            fontFamilyObj.group = this._group[5]
            fontFamilyObj.editor = 'text'

            // 注记字体颜色
            const fontColorObj = {}
            fontColorObj.name = this._displayTextContentName[5]
            fontColorObj.value = this.colorGeometryToString(
                graphicObject.symbolTextStyle.foreColor
            )
            fontColorObj.group = this._group[5]
            fontColorObj.editor = 'colorpicker'

            // 注记边框
            const fontHaloObj = {}
            fontHaloObj.name = this._displayTextContentName[6]
            fontHaloObj.value = this.checkboxValueToString(
                graphicObject.symbolTextStyle.outline
            )
            fontHaloObj.group = this._group[5]
            fontHaloObj.editor = {
                type: 'switch',
                options: { on: true, off: false },
            }

            // 注记边框宽度
            const outlineWidthObj = {}
            outlineWidthObj.name = this._displayTextContentName[7]
            outlineWidthObj.value = graphicObject.symbolTextStyle.outlineWidth
            outlineWidthObj.group = this._group[5]
            outlineWidthObj.editor = 'text'

            // 注记边框颜色
            const outlineColorObj = {}
            outlineColorObj.name = this._displayTextContentName[8]
            outlineColorObj.value = this.colorGeometryToString(
                graphicObject.symbolTextStyle.outlineColor
            )
            outlineColorObj.group = this._group[5]
            outlineColorObj.editor = 'colorpicker'

            //总是显示中间注记
            const alwaysHasMiddelText = {}
            alwaysHasMiddelText.name = this._displayTextContentName[9]
            alwaysHasMiddelText.value = this.checkboxValueToString(
                graphicObject.alwaysHasMiddelText
            )
            alwaysHasMiddelText.group = this._group[5]
            alwaysHasMiddelText.editor = {
                type: 'switch',
                options: { on: true, off: false },
            }

            // 衬线类型
            const surroundLineTypeObj = {}
            surroundLineTypeObj.name = this._displaySurroundLineName[0]
            surroundLineTypeObj.value =
                this.surroundLineTypeToString(graphicObject)
            surroundLineTypeObj.group = this._group[1]
            surroundLineTypeObj.editor = {
                type: 'combobox',
                options: {
                    valueField: 'value',
                    textField: 'text',
                    data: surroundLineTypeRows,
                },
            }

            // 衬线宽
            const surroundLineWidthObj = {}
            surroundLineWidthObj.name = this._displaySurroundLineName[1]
            surroundLineWidthObj.value =
                1 === graphicObject.symbolType
                    ? graphicObject.gridSurroundLineWidth
                    : graphicObject.symbolStyle.surroundLineWidth
            surroundLineWidthObj.group = this._group[1]
            surroundLineWidthObj.editor = 'text'

            // 衬线色
            const surroundLineColorObj = {}
            surroundLineColorObj.name = this._displaySurroundLineName[2]
            surroundLineColorObj.value = this.colorGeometryToString(
                graphicObject.symbolStyle.surroundLineColor
            )
            surroundLineColorObj.group = this._group[1]
            surroundLineColorObj.editor = 'colorpicker'

            // 标号大小
            let gridSymbolSizeXObj,
                gridSymbolSizeYObj,
                pictureSymbolSizeXObj,
                pictureSymbolSizeYObj,
                rotationX,
                rotationY,
                rotationZ,
                scaleX
            let modelScale, modelRotateX, modelRotateY, modelRotateZ
            if (graphicObject._symbolType === 1) {
                gridSymbolSizeXObj = {}
                gridSymbolSizeXObj.name = this._displayName[6]
                gridSymbolSizeXObj.value = parseInt(
                    graphicObject.gridSymbolSize.x
                )
                gridSymbolSizeXObj.group = this._group[2]
                gridSymbolSizeXObj.editor = 'text'

                // 标号大小
                gridSymbolSizeYObj = {}
                gridSymbolSizeYObj.name = this._displayName[7]
                gridSymbolSizeYObj.value = parseInt(
                    graphicObject.gridSymbolSize.y
                )
                gridSymbolSizeYObj.group = this._group[2]
                gridSymbolSizeYObj.editor = 'text'

                // 图片大小X
                pictureSymbolSizeXObj = {}
                pictureSymbolSizeXObj.name = this._displayName[6]
                pictureSymbolSizeXObj.value = graphicObject.pictureSymbolSize.x
                pictureSymbolSizeXObj.group = this._group[10]
                pictureSymbolSizeXObj.editor = 'text'

                // 图片大小Y
                pictureSymbolSizeYObj = {}
                pictureSymbolSizeYObj.name = this._displayName[7]
                pictureSymbolSizeYObj.value = graphicObject.pictureSymbolSize.y
                pictureSymbolSizeYObj.group = this._group[10]
                pictureSymbolSizeYObj.editor = 'text'
                if (2 === graphicObject.showMode) {
                    modelScale = {}
                    modelScale.name = this._displayName[12]
                    modelScale.value = graphicObject.modelScale.x
                    modelScale.group = this._group[8]
                    modelScale.editor = 'text'
                } else if (0 === graphicObject.showMode) {
                    // 缩放比例X
                    scaleX = {}
                    scaleX.name = this._displayName[13]
                    scaleX.value = graphicObject.vectorScale
                    scaleX.group = this._group[8]
                    scaleX.editor = 'text'
                }

                if (2 === graphicObject.showMode) {
                    modelRotateX = {}
                    modelRotateX.name = this._displayName[8]
                    modelRotateX.value = graphicObject.modelRotate.x
                    modelRotateX.group = this._group[9]
                    modelRotateX.editor = 'text'

                    modelRotateY = {}
                    modelRotateY.name = this._displayName[9]
                    modelRotateY.value = graphicObject.modelRotate.y
                    modelRotateY.group = this._group[9]
                    modelRotateY.editor = 'text'

                    modelRotateZ = {}
                    modelRotateZ.name = this._displayName[10]
                    modelRotateZ.value = graphicObject.modelRotate.z
                    modelRotateZ.group = this._group[9]
                    modelRotateZ.editor = 'text'
                } else if (0 === graphicObject.showMode) {
                    // 旋转角度X
                    rotationX = {}
                    rotationX.name = this._displayName[8]
                    rotationX.value = graphicObject.vectorRotate.x
                    rotationX.group = this._group[9]
                    rotationX.editor = 'text'

                    // 旋转角度Y
                    rotationY = {}
                    rotationY.name = this._displayName[9]
                    rotationY.value = graphicObject.vectorRotate.y
                    rotationY.group = this._group[9]
                    rotationY.editor = 'text'

                    // 旋转角度Z
                    rotationZ = {}
                    rotationZ.name = this._displayName[10]
                    rotationZ.value = graphicObject.vectorRotate.z
                    rotationZ.group = this._group[9]
                    rotationZ.editor = 'text'
                }
            }

            const selectedFeature = graphicObject

            if (
                34 === selectedFeature.symbolType ||
                20 === selectedFeature.symbolType
            ) {
                if (20 === selectedFeature.symbolType) {
                    rows.push(picturePathObj)
                    rows.push(pictureSymbolSizeXObj)
                    rows.push(pictureSymbolSizeYObj)
                } else {
                    rows.push(textContentObj)
                    rows.push(fontHaloObj)
                    rows.push(fontBackColor)
                    rows.push(fontSizeObj)
                    rows.push(fontFamilyObj)
                    rows.push(fontColorObj)
                    rows.push(outlineWidthObj)
                    rows.push(outlineColorObj)
                }
            }

            if (selectedFeature.middleMarkExist) {
                rows.push(alwaysHasMiddelText)
            }

            // 点标号
            if (1 === selectedFeature.symbolType) {
                if (
                    0 === selectedFeature.showMode ||
                    1 === selectedFeature.showMode
                ) {
                    rows.push(surroundLineTypeObj)
                    rows.push(surroundLineWidthObj)
                    rows.push(surroundLineColorObj)
                    rows.push(dotSymbolRankObj)
                }
                rows.push(dotSymbolShowModeObj)
                if (1 === selectedFeature.showMode) {
                    rows.push(dotSymbolNegativeImageObj)
                }
                rows.push(modelIdObj)
                if (0 === selectedFeature.showMode) {
                    rows.push(scaleX)
                    rows.push(rotationX)
                    rows.push(rotationY)
                    rows.push(rotationZ)
                }
                if (2 === selectedFeature.showMode) {
                    rows.push(modelScale)
                    rows.push(modelRotateX)
                    rows.push(modelRotateY)
                    rows.push(modelRotateZ)
                }
                if (3 === selectedFeature.showMode) {
                    rows.push(pictureSymbolSizeXObj)
                    rows.push(pictureSymbolSizeYObj)
                }
                rows.push(picturePathObj)
                if (
                    0 === selectedFeature.showMode ||
                    1 === selectedFeature.showMode
                ) {
                    rows.push(fillBackColorObj)
                    rows.push(fillBackOpaqueObj)
                    rows.push(fillGradientAngleObj)
                    rows.push(fillGradientModeObj)
                    rows.push(fillGradientOffsetRatioYObj)
                    rows.push(fillGradientOffsetRatioXObj)
                    rows.push(fillForeColorObj)
                    rows.push(fillSymbolIdObj)
                    rows.push(fillOpaqueRateObj)
                }
                if (
                    0 === selectedFeature.showMode ||
                    1 === selectedFeature.showMode ||
                    2 === selectedFeature.showMode
                ) {
                    rows.push(textContentObj)
                    rows.push(fontSizeObj)
                    rows.push(fontColorObj)
                    rows.push(fontFamilyObj)
                    rows.push(markPosObj)
                    rows.push(fontHaloObj)
                    rows.push(outlineWidthObj)
                    rows.push(outlineColorObj)
                }
                if (
                    0 === selectedFeature.showMode ||
                    1 === selectedFeature.showMode
                ) {
                    rows.push(lineWidthObj)
                    rows.push(lineColorObj)
                    if (1 === selectedFeature.showMode) {
                        rows.push(lineStyleObj)
                        rows.push(gridSymbolSizeXObj)
                        rows.push(gridSymbolSizeYObj)
                    }
                }

                const longitudeObj = {}
                longitudeObj.name = this._displayPositionName[0]
                longitudeObj.value = selectedFeature.localPoints[0].x
                longitudeObj.group = '位置点'
                longitudeObj.index = 0
                longitudeObj.editor = 'text'

                const latitudeObj = {}
                latitudeObj.name = this._displayPositionName[1]
                latitudeObj.value = selectedFeature.localPoints[0].y
                latitudeObj.group = '位置点'
                latitudeObj.index = 0
                latitudeObj.editor = 'text'

                const altitudeObj = {}
                altitudeObj.name = this._displayPositionName[2]
                altitudeObj.value = selectedFeature.localPoints[0].z
                altitudeObj.group = '位置点'
                altitudeObj.index = 0
                altitudeObj.editor = 'text'

                rows.push(longitudeObj)
                rows.push(latitudeObj)
                rows.push(altitudeObj)
            } else {
                rows.push(surroundLineTypeObj)
                rows.push(surroundLineWidthObj)
                rows.push(surroundLineColorObj)
                rows.push(fillBackColorObj)
                rows.push(fillBackOpaqueObj)
                rows.push(fillGradientAngleObj)
                rows.push(fillGradientModeObj)
                rows.push(fillGradientOffsetRatioYObj)
                rows.push(fillGradientOffsetRatioXObj)
                rows.push(fillForeColorObj)
                rows.push(fillSymbolIdObj)
                rows.push(fillOpaqueRateObj)
                rows.push(lineWidthObj)
                rows.push(lineColorObj)
                rows.push(extendWallObj)
                rows.push(extendWallOpacity)
                rows.push(isClampToGround)
                if (selectedFeature.subSymbols) {
                    let i = 0
                    //子标号
                    for (i = 0; i < selectedFeature.subSymbols.length; ++i) {
                        const objectSubCode = {}
                        objectSubCode.name = 'Code'
                        objectSubCode.value = selectedFeature.subSymbols[i].code
                        objectSubCode.group = this._group[6]
                        objectSubCode.editor = {
                            type: 'combobox',
                            options: {
                                valueField: 'value',
                                textField: 'text',
                                data: subSymbolsTypeRows,
                            },
                        }
                        objectSubCode.index = i
                        rows.push(objectSubCode)
                    }
                    if (
                        (0 === selectedFeature.subSymbols.length &&
                            0 === selectedFeature.libID &&
                            1025 === selectedFeature.code) ||
                        (0 === selectedFeature.subSymbols.length &&
                            100 === selectedFeature.libID &&
                            25200 === selectedFeature.code) ||
                        (0 === selectedFeature.subSymbols.length &&
                            100 === selectedFeature.libID &&
                            3020901 === selectedFeature.code)
                    ) {
                        const objectSubCode1 = {}
                        objectSubCode1.name = 'Code'
                        objectSubCode1.value = subSymbolsTypeString(
                            selectedFeature.subSymbols.length,
                            selectedFeature
                        )
                        objectSubCode1.group = this._group[6]
                        objectSubCode1.editor = {
                            type: 'combobox',
                            options: {
                                valueField: 'value',
                                textField: 'text',
                                data: subSymbolsTypeRows,
                            },
                        }
                        objectSubCode1.index = i
                        rows.push(objectSubCode1)
                    }
                }

                if (
                    1025 === selectedFeature.symbolType &&
                    selectedFeature.subSymbols.length > 0
                ) {
                    const objectLibID = {}
                    objectLibID.name = 'LibID'
                    objectLibID.value = libIDToString(
                        selectedFeature.subSymbols[0].libID
                    )
                    objectLibID.group = this._group[6]
                    objectLibID.editor = 'text'
                    rows.push(objectLibID)
                }

                for (let i = 0; i < selectedFeature.localPoints.length; ++i) {
                    const longitudeObj = {}
                    longitudeObj.name = this._displayPositionName[0]
                    longitudeObj.value = selectedFeature.localPoints[i].x
                    longitudeObj.group = '位置点' + (i + 1)
                    longitudeObj.index = i
                    longitudeObj.editor = 'text'

                    const latitudeObj = {}
                    latitudeObj.name = this._displayPositionName[1]
                    latitudeObj.value = selectedFeature.localPoints[i].y
                    latitudeObj.group = '位置点' + (i + 1)
                    latitudeObj.index = i
                    latitudeObj.editor = 'text'

                    const altitudeObj = {}
                    altitudeObj.name = this._displayPositionName[2]
                    altitudeObj.value = selectedFeature.localPoints[i].z
                    altitudeObj.group = '位置点' + (i + 1)
                    altitudeObj.index = i
                    altitudeObj.editor = 'text'

                    rows.push(longitudeObj)
                    rows.push(latitudeObj)
                    rows.push(altitudeObj)
                }
            }
            return rows
        }
    }
    updateSelectFeature(updated, selectFeature) {
        if (null != updated && selectFeature) {
            switch (updated.name) {
                case this._displayName[0]:
                    selectFeature.isNegativeImage = this.fromCheckboxValue(
                        updated.value
                    )
                    break
                case this._displayName[1]:
                    selectFeature.symbolRank = parseInt(updated.value)
                    break
                case this._displayName[2]:
                    {
                        const mode = parseInt(updated.value)
                        if (
                            2 === mode &&
                            0 === selectFeature.modelPath.length
                        ) {
                            return
                        }
                        if (
                            3 === mode &&
                            0 === selectFeature.picturePath.length
                        ) {
                            return
                        }
                        selectFeature.showMode = parseInt(updated.value)
                    }
                    break
                case this._displayName[3]:
                    selectFeature.modelPath = updated.value
                    break
                case this._displayName[4]:
                    selectFeature.picturePath = updated.value
                    break
                case this._displayName[5]:
                    selectFeature.symbolStyle.wholeHeight = parseInt(
                        updated.value
                    )
                    break
                case this._displayName[6]:
                    if (updated.group === this._group[10]) {
                        selectFeature.pictureSymbolSize = new Cesium.Cartesian2(
                            parseInt(updated.value),
                            selectFeature.pictureSymbolSize.y
                        )
                    } else {
                        selectFeature.gridSymbolSize = new Cesium.Cartesian2(
                            parseInt(updated.value),
                            selectFeature.gridSymbolSize.y
                        )
                    }
                    break
                case this._displayName[7]:
                    if (updated.group === this._group[10]) {
                        selectFeature.pictureSymbolSize = new Cesium.Cartesian2(
                            selectFeature.pictureSymbolSize.x,
                            parseInt(updated.value)
                        )
                    } else {
                        selectFeature.gridSymbolSize = new Cesium.Cartesian2(
                            selectFeature.gridSymbolSize.x,
                            parseInt(updated.value)
                        )
                    }
                    break
                case this._displayName[8]:
                    if (updated.group === this._group[8]) {
                        selectFeature.scale.x = parseInt(updated.value)
                    } else if (updated.group === this._group[9]) {
                        if (2 === selectFeature.showMode) {
                            const rotate = selectFeature.modelRotate
                            selectFeature.setModelRotate(
                                parseInt(updated.value),
                                rotate.y,
                                rotate.z
                            )
                        } else {
                            const rotate = selectFeature.vectorRotate
                            selectFeature.setVectorRotate(
                                parseInt(updated.value),
                                rotate.y,
                                rotate.z
                            )
                        }
                    }
                    break
                case this._displayName[9]:
                    if (updated.group === this._group[8]) {
                        selectFeature.scale.y = parseInt(updated.value)
                    } else if (updated.group === this._group[9]) {
                        if (2 === selectFeature.showMode) {
                            const rotate = selectFeature.modelRotate
                            selectFeature.setModelRotate(
                                rotate.x,
                                parseInt(updated.value),
                                rotate.z
                            )
                        } else {
                            const rotate = selectFeature.vectorRotate
                            selectFeature.setVectorRotate(
                                rotate.x,
                                parseInt(updated.value),
                                rotate.z
                            )
                        }
                    }
                    break
                case this._displayName[10]:
                    if (updated.group === this._group[8]) {
                        selectFeature.scale.z = parseInt(updated.value)
                    } else if (updated.group === this._group[9]) {
                        if (2 === selectFeature.showMode) {
                            const rotate = selectFeature.modelRotate
                            selectFeature.setModelRotate(
                                rotate.x,
                                rotate.y,
                                parseInt(updated.value)
                            )
                        } else {
                            const rotate = selectFeature.vectorRotate
                            selectFeature.setVectorRotate(
                                rotate.x,
                                rotate.y,
                                parseInt(updated.value)
                            )
                        }
                    }
                    break
                case this._displayName[12]:
                    {
                        const modelScale = selectFeature.modelScale
                        selectFeature.modelScale = new Cesium.Cartesian3(
                            parseInt(updated.value),
                            modelScale.y,
                            modelScale.z
                        )
                    }
                    break
                case this._displayName[13]:
                    selectFeature.vectorScale = parseFloat(updated.value)
                    break
                case this._displaySurroundLineName[0]:
                    selectFeature.symbolStyle.surroundLineType = parseInt(
                        updated.value
                    )
                    break
                case this._displaySurroundLineName[1]:
                    if (1 === selectFeature.symbolType) {
                        selectFeature.gridSurroundLineWidth = parseInt(
                            updated.value
                        )
                    } else {
                        selectFeature.symbolStyle.surroundLineWidth = parseInt(
                            updated.value
                        )
                    }
                    break
                case this._displaySurroundLineName[2]:
                    selectFeature.symbolStyle.surroundLineColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displaySurroundLineName[3]:
                    break
                case this._displayFillStyleName[0]:
                    selectFeature.symbolStyle.fillBackColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayFillStyleName[1]:
                    selectFeature.symbolStyle.fillBackOpaque =
                        this.fromCheckboxValue(updated.value)
                    break
                case this._displayFillStyleName[2]:
                    selectFeature.symbolStyle.fillGradientAngle = parseInt(
                        updated.value
                    )
                    break
                case this._displayFillStyleName[3]:
                    selectFeature.symbolStyle.fillGradientMode = parseInt(
                        updated.value
                    )
                    break
                case this._displayFillStyleName[4]:
                    selectFeature.symbolStyle.fillGradientOffsetRatioY =
                        parseInt(updated.value)
                    break
                case this._displayFillStyleName[5]:
                    selectFeature.symbolStyle.fillGradientOffsetRatioX =
                        parseInt(updated.value)
                    break
                case this._displayFillStyleName[6]:
                    selectFeature.symbolStyle.fillForeColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayFillStyleName[7]:
                    selectFeature.symbolStyle.fillSymbolID = parseInt(
                        updated.value
                    )
                    break
                case this._displayFillStyleName[8]:
                    selectFeature.symbolStyle.fillOpaqueRate = parseInt(
                        updated.value
                    )
                    break
                case this._displayLineStyleName[0]:
                    if (1 === selectFeature.symbolType) {
                        selectFeature.gridLineWidth = parseFloat(updated.value)
                    } else {
                        selectFeature.symbolStyle.lineWidth = parseFloat(
                            updated.value
                        )
                    }
                    break
                case this._displayLineStyleName[1]:
                    selectFeature.symbolStyle.lineColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayLineStyleName[2]:
                    selectFeature.lineSymbolID = parseInt(updated.value)
                    break
                case this._displayTextContentName[0]:
                    selectFeature.textContent = updated.value
                    break
                case this._displayTextContentName[1]:
                    selectFeature.textPos = parseInt(updated.value)
                    break
                case this._displayTextContentName[2]:
                    selectFeature.symbolTextStyle.backColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayTextContentName[3]:
                    selectFeature.symbolTextStyle.fontSize = parseInt(
                        updated.value
                    )
                    break
                case this._displayTextContentName[4]:
                    selectFeature.symbolTextStyle.fontName = updated.value
                    break
                case this._displayTextContentName[5]:
                    selectFeature.symbolTextStyle.foreColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayTextContentName[6]:
                    selectFeature.symbolTextStyle.outline =
                        this.fromCheckboxValue(updated.value)
                    break
                case this._displayTextContentName[7]:
                    selectFeature.symbolTextStyle.outlineWidth = parseFloat(
                        updated.value
                    )
                    break
                case this._displayTextContentName[8]:
                    selectFeature.symbolTextStyle.outlineColor = colorConvert(
                        updated.value
                    )
                    break
                case this._displayTextContentName[9]:
                    selectFeature.alwaysHasMiddelText = this.fromCheckboxValue(
                        updated.value
                    )
                    break
                case this._displayPositionName[0]:
                    {
                        const pts = []
                        for (
                            let i = 0;
                            i < selectFeature.localPoints.length;
                            ++i
                        ) {
                            pts.push(selectFeature.localPoints[i].clone())
                        }
                        pts[updated.index].x = parseInt(updated.value)
                        selectFeature.localPoints = pts
                    }
                    break
                case this._displayPositionName[1]:
                    {
                        const pts = []
                        for (
                            let i = 0;
                            i < selectFeature.localPoints.length;
                            ++i
                        ) {
                            pts.push(selectFeature.localPoints[i].clone())
                        }
                        pts[updated.index].y = parseInt(updated.value)
                        selectFeature.localPoints = pts
                    }
                    break
                case this._displayPositionName[2]:
                    {
                        const pts = []
                        for (
                            let i = 0;
                            i < selectFeature.localPoints.length;
                            ++i
                        ) {
                            pts.push(selectFeature.localPoints[i].clone())
                        }
                        pts[updated.index].z = parseInt(updated.value)
                        selectFeature.localPoints = pts
                    }
                    break
                case this._displayExtendWallName[0]:
                    selectFeature.extendWallHeight = parseFloat(updated.value)
                    break
                case this._displayExtendWallName[1]:
                    selectFeature.extendWallOpacity = parseFloat(updated.value)
                    break
                case this._algoGroup[0]:
                    selectFeature.isClampToGround = this.fromCheckboxValue(
                        updated.value
                    )
                    break
                default:
                    break
            }
            if (updated.group == this._group[6]) {
                if (updated.name == 'LibID') {
                    if (null !== updated.value) {
                        selectFeature.subSymbols[0].libID = parseInt(
                            updated.value
                        )
                    }
                }
                //设置子标号
                if (updated.name == 'Code') {
                    const code = parseInt(updated.value)

                    if (selectFeature.symbolType === 1025 && code != null) {
                        const symbolLibManager =
                            this._plotting.getSymbolLibManager()
                        const subCode = symbolLibManager.findSymbolByCode(code)
                        if (
                            subCode.length !== 0 &&
                            subCode[0].symbolType === 'SYMBOL_DOT'
                        ) {
                            //selectFeature.subSymbols[updated.index] = {libID : subCode[0].libID, code : code};
                            const temp = { libID: subCode[0].libID, code: code }
                            selectFeature.setSubSymbols(temp, updated.index)
                        }
                    } else {
                        const temp = { libID: selectFeature.libID, code: code }
                        selectFeature.setSubSymbols(temp, updated.index)
                    }
                }
            }
        }
    }
    getAnnotationRows(graphicObject) {
        const annotationRows = []
        annotationRows.push({ value: '0', text: '左上' })
        annotationRows.push({ value: '1', text: '左下' })
        annotationRows.push({ value: '2', text: '右上' })
        annotationRows.push({ value: '3', text: '右下' })
        annotationRows.push({ value: '4', text: '上' })
        annotationRows.push({ value: '5', text: '下' })
        annotationRows.push({ value: '6', text: '左' })
        annotationRows.push({ value: '7', text: '右' })
        if (graphicObject.middleMarkExist) {
            annotationRows.push({ value: '8', text: '中间' })
        }
        return annotationRows
    }
    getSymbolRankRows(graphicObject) {
        let symbolRanks = []
        if (graphicObject && graphicObject.symbolRanks) {
            symbolRanks = graphicObject.symbolRanks
        }
        const rows = []
        rows.push({ value: '0', text: '无级别' })
        for (let i = 0; i < symbolRanks.length; ++i) {
            if (1 == symbolRanks[i]) {
                rows.push({ value: '1', text: '军区级' })
            } else if (2 == symbolRanks[i]) {
                rows.push({ value: '2', text: '副大军区级' })
            } else if (3 == symbolRanks[i]) {
                rows.push({ value: '3', text: '集团军级' })
            } else if (4 == symbolRanks[i]) {
                rows.push({ value: '4', text: '师级' })
            } else if (5 == symbolRanks[i]) {
                rows.push({ value: '5', text: '旅级' })
            } else if (6 == symbolRanks[i]) {
                rows.push({ value: '6', text: '团级' })
            } else if (7 == symbolRanks[i]) {
                rows.push({ value: '7', text: '营级' })
            } else if (8 == symbolRanks[i]) {
                rows.push({ value: '8', text: '连级' })
            } else if (9 == symbolRanks[i]) {
                rows.push({ value: '9', text: '排级' })
            }
        }
        return rows
    }
    getSurroundLineTypeRows(graphicObject) {
        const rows = []
        if (null == graphicObject || undefined == graphicObject) {
            return []
        }
        const symbolType = graphicObject.symbolType
        if (1 == symbolType) {
            rows.push({ value: '0', text: '无衬线' })
            rows.push({ value: '1', text: '有衬线' })
        } else {
            rows.push({ value: '0', text: '无衬线' })
            rows.push({ value: '1', text: '内侧衬线' })
            rows.push({ value: '2', text: '外侧衬线' })
            rows.push({ value: '3', text: '双侧衬线' })
        }
        return rows
    }
    getDotShowModeRows(graphicObject) {
        const rows = []
        rows.push({ value: '0', text: '矢量模式' })
        rows.push({ value: '1', text: '公告板模式' })
        rows.push({ value: '2', text: '模型模式' })
        rows.push({ value: '3', text: '图片模式' })
        return rows
    }
    getFillGradientModeRows(graphicObject) {
        const rows = []

        rows.push({ value: '0', text: '无渐变' })
        rows.push({ value: '1', text: '线性渐变' })
        rows.push({ value: '2', text: '辐射渐变' })

        return rows
    }
    getLineStyleRows(graphicObject) {
        const rows = []

        rows.push({ value: '0', text: '实线' })
        rows.push({ value: '1', text: '长虚线' })
        rows.push({ value: '2', text: '由点构成的直线' })
        rows.push({ value: '3', text: '由线划线段构成的直线' })
        rows.push({ value: '4', text: '由重复的线划点图案构成的直线' })

        return rows
    }
    getSubSymbolsTypeRows(graphicObject) {
        const rows = []
        rows.push({ value: '0', text: '' })

        if (100 === graphicObject.libID) {
            rows.push({ value: '100', text: '陆军' })
            rows.push({ value: '200', text: '海军' })
            rows.push({ value: '300', text: '空军' })
        } else if (123 === graphicObject.libID) {
            rows.push({ value: '10101', text: '武装警察部队' })
            rows.push({ value: '10102', text: '防爆装甲' })
            rows.push({ value: '10103', text: '火炮' })
        } else if (900 === graphicObject.libID) {
            rows.push({ value: '910200', text: '人民防空重点城市' })
            rows.push({ value: '910300', text: '人民防空基本指挥所' })
            rows.push({ value: '910402', text: '水路抢修专业队' })
        } else if (0 === graphicObject.libID) {
            rows.push({ value: '9', text: '刑警' })
            rows.push({ value: '80103', text: '交警' })
            rows.push({ value: '80109', text: '专业警' })
        }
        return rows
    }
    getFillSymbolIDRows(graphicObject) {
        const rows = []
        rows.push({ value: '0', text: '实填充' })
        rows.push({ value: '1', text: '无填充' })
        // rows.push({"value" : "2", "text" : "向上斜填充"});
        // rows.push({"value" : "3", "text" : "十字填充"});
        // rows.push({"value" : "4", "text" : "交叉填充"});
        // rows.push({"value" : "5", "text" : "反斜线填充"});
        // rows.push({"value" : "6", "text" : "水平填充"});
        // rows.push({"value" : "7", "text" : "竖直填充"});
        return rows
    }
    displayToString(display) {
        if (display && display === 'none') {
            return '不显示'
        }
        return '显示'
    }
    checkboxValueToString(checkboxValue) {
        if (checkboxValue === true || checkboxValue === 'true') {
            // return 'true'
            return true
        } else if (checkboxValue === false || checkboxValue === 'false') {
            // return 'false'
            return false
        }
    }
    fromCheckboxValue(checkboxStr) {
        if (checkboxStr === 'true' || checkboxStr === true) {
            return true
        } else if (checkboxStr === 'false' || checkboxStr === false) {
            return false
        }
    }
    symbolRankToString(symbolRank) {
        if (0 == symbolRank) {
            return '无级别'
        } else if (1 == symbolRank) {
            return '军区级'
        } else if (2 == symbolRank) {
            return '副大军区级'
        } else if (3 == symbolRank) {
            return '集团军级'
        } else if (4 == symbolRank) {
            return '师级'
        } else if (5 == symbolRank) {
            return '旅级'
        } else if (6 == symbolRank) {
            return '团级'
        } else if (7 == symbolRank) {
            return '营级'
        } else if (8 == symbolRank) {
            return '连级'
        } else if (9 == symbolRank) {
            return '排级'
        }
    }
    showModeToString(dotShowMode) {
        if (0 === dotShowMode) {
            return '矢量模式'
        } else if (1 === dotShowMode) {
            return '公告板模式'
        } else if (2 === dotShowMode) {
            return '模型模式'
        } else if (3 === dotShowMode) {
            return '图片模式'
        } else {
            return '未定义'
        }
    }
    fillGradientModeToString(fillGradientMode) {
        if (0 === fillGradientMode) {
            return '无渐变'
        } else if (1 === fillGradientMode) {
            return '线性渐变'
        } else if (2 === fillGradientMode) {
            return '辐射渐变'
        }
    }
    annotationToString(annotation) {
        if (0 === annotation) {
            return '左上'
        } else if (1 === annotation) {
            return '左下'
        } else if (2 === annotation) {
            return '右上'
        } else if (3 === annotation) {
            return '右下'
        } else if (4 === annotation) {
            return '上'
        } else if (5 === annotation) {
            return '下'
        } else if (6 === annotation) {
            return '左'
        } else if (7 === annotation) {
            return '右'
        } else if (8 === annotation) {
            return '中间'
        }
    }
    surroundLineTypeToString(graphicObject) {
        if (1 === graphicObject.symbolType) {
            if (0 === graphicObject.symbolStyle.surroundLineType) {
                return '无衬线'
            } else if (1 === graphicObject.symbolStyle.surroundLineType) {
                return '有衬线'
            }
        } else {
            if (0 === graphicObject.symbolStyle.surroundLineType) {
                return '无衬线'
            } else if (1 === graphicObject.symbolStyle.surroundLineType) {
                return '内侧衬线'
            } else if (2 === graphicObject.symbolStyle.surroundLineType) {
                return '外侧衬线'
            } else if (3 === graphicObject.symbolStyle.surroundLineType) {
                return '双侧衬线'
            }
        }
    }
    colorGeometryToString(color) {
        const value = color.value
        let red, green, blue

        if (undefined !== value && null !== value) {
            red =
                value[2] > 15
                    ? value[2].toString(16)
                    : '0' + value[2].toString(16)
            green =
                value[1] > 15
                    ? value[2].toString(16)
                    : '0' + value[1].toString(16)
            blue =
                value[0] > 15
                    ? value[0].toString(16)
                    : '0' + value[0].toString(16)
        } else {
            red = color.red * 255
            red = red > 15 ? red.toString(16) : '0' + red
            green = color.green * 255
            green = green > 15 ? green.toString(16) : '0' + green
            blue = color.blue * 255
            blue = blue > 15 ? blue.toString(16) : '0' + blue
        }
        return '#' + red + green + blue
    }
    lineStyleToString(lineStyle) {
        if (0 === lineStyle) {
            return '实线'
        } else if (1 === lineStyle) {
            return '长虚线'
        } else if (2 === lineStyle) {
            return '由点构成的直线'
        } else if (3 === lineStyle) {
            return '由线划线段构成的直线'
        } else if (4 === lineStyle) {
            return '由重复的线划点图案构成的直线'
        }
    }
    fillSymbolIdToString(fillSymbolID) {
        switch (fillSymbolID) {
            case 0:
                return '实填充'
            case 1:
                return '无填充'
        }
    }
}
